var assert = require('node-assert-extras');
var mSession = require(__testRoot + '/model/SessionEntity');
var ccResponse = require(__testRoot + '/control/ResponseHooks');

/**
 * ResponseHooks Control Testing
 * @author jmanero
 */
suite("ResponseHooks Control", function() {
	test("Parse signInResponse", function() {
		var message = '<response id="12351341234324" varsion="1.0" success="true">'
			+ '<signInResponse id="asdklj23" type="closed" question="where to eat?" numChoices="4" numRounds="3" position="3">'
			+ '<choice value="McDonald\'s" index="0"/>'
			+ '<choice value="Wendy\'s" index="1"/>'
			+ '<choice value="Burger King" index="2"/>'
			+ '<choice value="Sushi Palace" index="3"/>'
			+ '</signInResponse>'
			+ '</response>';
		
		var session = new mSession("123456");
		var handler = new ccResponse();
		handler.handle(message, session);
		
		assert.equal("asdklj23", session.game);
	});
	
	test("Parse createResponse", function() {
		var message = '<response version="1.0" id="589a39591271844e3fbe32bbb9281ad9" success="true">'
			+ '<createResponse id="sjlk2sjkl"/>'
			+ '</response>';
		
		var session = new mSession("123456");
		var handler = new ccResponse();
		handler.handle(message, session);
		
		assert.equal("sjlk2sjkl", session.game);
	});
});
